#ifndef XTREECHECKMANAGER_H
#define XTREECHECKMANAGER_H
#include <QStandardItem>
#include <QObject>

class xTreeCheckManager : public QObject
{
    Q_OBJECT
public:
    xTreeCheckManager();

    //获取场景加载管理器
    static xTreeCheckManager *getInstance();

    //树形节点变化
    void treeItemChanged(QStandardItem *item);

    //设置check
    void setItemChecked(QStandardItem *item) const;

    //设置partial check
    void setItemPartialChecked(QStandardItem *item);

    //判断所有的子节点check
    bool isAllChildChecked(QStandardItem *item) const;

protected:
    void treeItemCheckAllChild(QStandardItem *item, bool check);

    void treeItemCheckAllChildRecursion(QStandardItem *item, bool check);

    Qt::CheckState checkSibling(QStandardItem* item);

    void treeItemCheckChildChanged(QStandardItem *item);
};

#endif // XTREECHECKMANAGER_H
